<html>
<head><meta charset="utf-8"><title>How to get the `ExprKind` of an expression given the `HirId` · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20get.20the.20.60ExprKind.60.20of.20an.20expression.20given.20the.20.60HirId.60.html">How to get the `ExprKind` of an expression given the `HirId`</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="230201295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20get%20the%20%60ExprKind%60%20of%20an%20expression%20given%20the%20%60HirId%60/near/230201295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Henry Boisdequin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20get.20the.20.60ExprKind.60.20of.20an.20expression.20given.20the.20.60HirId.60.html#230201295">(Mar 14 2021 at 00:53)</a>:</h4>
<p>I have an <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir_id/struct.HirId.html"><code>HirId</code></a> and I would like to find out what variant of <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/enum.ExprKind.html"><code>ExprKind</code></a> it is. What would be the best way to do this?</p>



<a name="230205922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20get%20the%20%60ExprKind%60%20of%20an%20expression%20given%20the%20%60HirId%60/near/230205922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20get.20the.20.60ExprKind.60.20of.20an.20expression.20given.20the.20.60HirId.60.html#230205922">(Mar 14 2021 at 02:26)</a>:</h4>
<p>Maybe <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html#method.expect_expr">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html#method.expect_expr</a> ?</p>



<a name="230206127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20get%20the%20%60ExprKind%60%20of%20an%20expression%20given%20the%20%60HirId%60/near/230206127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Henry Boisdequin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20get.20the.20.60ExprKind.60.20of.20an.20expression.20given.20the.20.60HirId.60.html#230206127">(Mar 14 2021 at 02:31)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20to.20get.20the.20.60ExprKind.60.20of.20an.20expression.20given.20the.20.60HirId.60/near/230205922">said</a>:</p>
<blockquote>
<p>Maybe <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html#method.expect_expr">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html#method.expect_expr</a> ?</p>
</blockquote>
<p>Thanks, I'll try it out</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>